10 PRINT "TIC TAC TOE"
20 PRINT "CREATIVE COMPUTING  MORRISTOWN, NEW JERSEY"
30 PRINT
35 PRINT
40 PRINT
50 REM
100 REM   THIS PROGRAM PLAYS TIC TAC TOE
110 REM   THE MACHINE GOES FIRST
120 PRINT "THE GAME BOARD IS NUMBERED:"
125 PRINT
130 PRINT "1  2  3"
135 PRINT "8  9  4"
137 PRINT "7  6  5"
140 PRINT
150 REM
160 REM
170 REM
190 REM
200 REM  MAIN PROGRAM
210 PRINT
220 PRINT
230 A=9
240 M=A
250 GOSUB 650
260 P=M
270 B=(P+1)-8*(((P+1)-1)/8)
280 M=B
290 GOSUB 650
300 Q=M
310 IF Q=(B+4)-8*(((B+4)-1)/8) THEN GOTO 360
320 C=(B+4)-8*(((B+4)-1)/8)
330 M=C
340 GOSUB 700
350 GOTO 730
360 C=(B+2)-8*(((B+2)-1)/8)
370 M=C
380 GOSUB 650
390 R=M
400 IF R=(C+4)-8*(((B+C)-1)/8) THEN GOTO 450
410 D=(C+4)-8*(((C+4)-1)/8)
420 M=D
430 GOSUB 700
440 GOTO 730
450 IF P%2=0 THEN GOTO 460
455 GOTO 500
460 D=(C+7)-8*(((C+7)-1)/8)
470 M=D
480 GOSUB 700
490 GOTO 730
500 D=(C+3)-8*(((C+3)-1)/8)
510 M=D
520 GOSUB 650
530 S=M
540 IF S=(D+4)-8*(((D+4)-1)/8) THEN GOTO 590
550 E=(D+4)-8*(((D+4)-1)/8)
560 M=E
570 GOSUB 700
580 REM
590 E=(D+6)-8*(((D+6)-1)/8)
600 M=E
610 GOSUB 700
620 PRINT "THE GAME IS A DRAW."
630 GOTO 750
640 REM
650 GOSUB 700
660 INPUT "YOUR MOVE ", M
680 RETURN
700 PRINT "COMPUTER MOVES ";M
710 RETURN
720 REM
730 PRINT "AND WINS ********"
750 END
